﻿using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Project.Model.EF6.Base;
using Newtonsoft.Json;

namespace Project.Model.EF6.Entity
{
    [Table("T_SGM_XLW_SALES_RECORD")]

    public class SalesRecord : ModelBase
    {
        [Key]
        public long ID { get; set; }
        public DateTime SCAN_TIME { get; set; }

        [Column(TypeName = "varchar2")]
        [StringLength(32)]
        public string QR_CODE { get; set; }
        public int STATUS { get; set; }

        [Column(TypeName = "varchar2")]
        [StringLength(32)]
        public string PRODUC_SPE_ID { get; set; }

        [Column(TypeName = "varchar2")]
        [StringLength(50)]
        public string PRODUC_SPE { get; set; }

        [Column(TypeName = "varchar2")]
        [StringLength(32)]
        public string PRODUCT_ID { get; set; }

        [Column(TypeName = "varchar2")]
        [StringLength(100)]
        public string PRODUCT_NAME { get; set; }
        public DateTime? PRODUCTTIME { get; set; }

        [Column(TypeName = "varchar2")]
        [StringLength(30)]
        public string SALEID { get; set; }

        [Column(TypeName = "varchar2")]
        [StringLength(30)]
        public string SALENAME { get; set; }

        [Column(TypeName = "varchar2")]
        [StringLength(32)]
        public string OPENID { get; set; }

        [Column(TypeName = "varchar2")]
        [StringLength(50)]
        public string WEIXIN_PROVINCE { get; set; }

        [Column(TypeName = "varchar2")]
        [StringLength(50)]
        public string NICK_NAME { get; set; }

        [Column(TypeName = "varchar2")]
        [StringLength(11)]
        public string MOBILE { get; set; }
        public int AREAID { get; set; }

        [JsonIgnore]
        [ForeignKey("AREAID")]
        public virtual ActiveConfig ActiveConfig { get; set; }

        [Column(TypeName = "varchar2")]
        [StringLength(50)]
        public string PROVINCE { get; set; }

        [Column(TypeName = "varchar2")]
        [StringLength(50)]
        public string CITY { get; set; }
        public decimal? REDPKT_AMOUNT { get; set; }
        public string REDPKT_SEND_FLG { get; set; }
        public DateTime? REDPKT_SEND_DATE { get; set; }
        public int? POINT { get; set; }//客户数据库为怪兽能量，在此处为红包积分值

        [Column(TypeName = "varchar2")]
        [StringLength(100)]
        public string MCH_BILL_NO { get; set; }
        public string ROW_STATUS { get; set; }

        [Column(TypeName = "varchar2")]
        [StringLength(30)]
        public string ROW_CREATE_USER { get; set; }

        [Column(TypeName = "varchar2")]
        [StringLength(30)]
        public string ROW_UPDATE_USER { get; set; }
        public string SHARED { get; set; }
        public DateTime? SHARE_DATE { get; set; }
        public decimal? SHARE_REDPKT { get; set; }

        [Column(TypeName = "varchar2")]
        [StringLength(32)]
        public string SHARE_WX_BILLNO { get; set; }

        [Column(TypeName = "varchar2")]
        [StringLength(500)]
        public string SEND_RED_RESULT { get; set; }

        [Column(TypeName = "varchar2")]
        [StringLength(100)]
        public string ORDER_CODE { get; set; }//红包订单号

        [Column(TypeName = "varchar2")]
        [StringLength(100)]
        public string ACITIVITY_ID { get; set; }

        [Column(TypeName = "varchar2")]
        [StringLength(100)]
        public string DISTRICT_NAME { get; set; }

        [Column(TypeName = "varchar2")]
        [StringLength(100)]
        public string ADDRESS { get; set; }

        [Column(TypeName = "varchar2")]
        [StringLength(100)]
        public string COUNTRY_CODE { get; set; }

        [Column(TypeName = "varchar2")]
        [StringLength(100)]
        public string COUNTRY_NAME { get; set; }

        [Column(TypeName = "varchar2")]
        [StringLength(100)]
        public string PROVINCE_CODE { get; set; }

        [Column(TypeName = "varchar2")]
        [StringLength(100)]
        public string CITY_CODE { get; set; }

        [Column(TypeName = "varchar2")]
        [StringLength(100)]
        public string LONGITUDE { get; set; }

        [Column(TypeName = "varchar2")]
        [StringLength(100)]
        public string LATITUDE { get; set; }

        [Column(TypeName = "varchar2")]
        [StringLength(100)]
        public string DISTRICT_CODE { get; set; }
        public int THE_LOTTERY { get; set; }//是否点击开奖（1：已点击开奖；0：未点击开奖）
        public int DELIVER_ID { get; set; }//地址ID（为-1时代表红包中奖记录，大于等于0时代表实物中奖记录）
        public int AWARDS_PRODUCT_ID { get; set; }//奖品ID

        [Column(TypeName = "varchar2")]
        [StringLength(100)]
        public string AWARDS_NAME { get; set; }//奖品名称

        public DateTime PRODUCT_ACTIVETIME { get; set; }
        [StringLength(100)]
        [Column(TypeName = "varchar2")]
        public string TASKBATCH_ID { get; set; }

        [NotMapped]
        public string Img { get; set; }//用户微信图像
        [NotMapped]
        public string DateShow { get; set; }
        [NotMapped]
        public string MoneyShow { get; set; }

        [NotMapped]
        public string Province => ActiveConfig?.PROVINCE ?? "";
    }
}
